<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="./bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
    <script src="./bootstrap/js/bootstrap.js"></script>
    <script>
        function subInfo(){
            let mcontact= document.getElementById("inputmcontact").value();
            let mphone= document.getElementById("inputmphone").value();
            let meail= document.getElementById("inputmeail").value();
            let maddress= document.getElementById("inputmaddress").value();
            let merchantType= document.getElementById("inputmerchantType").value();
            let mrealName= document.getElementById("inputmrealName").value();
            let midCard= document.getElementById("inputmidCard").value();
            let midCardImg= document.getElementById("inputmidCardImg").value();


            if (mcontact ==='' || mphone==='' || meail==='' || maddress==='' || merchantType==='' || mrealName===''|| midCard==='' || midCardImg===''){
                document.getElementById("tipShow").innerHTML ="请填写完整信息...";
                return;
        }else{
            document.getElementById("tipShow").innerHTML ="";
            let obj={mcontact:mcontact, mphone:mphone, memail:memail, maddress:maddress, merchantType:merchantType, mrealName:mrealName, midCard:midCard, midCardImg:midCardImg}

            $.ajax({
                type:"post",
                url:"/merchant/update",
                contentType:"application/json",
                dataType:"json",
                data:JSON.stringify(obj),
                success:function (data){
                    if (data.code===200){
                        document.getElementById("tipShow").innerHTML="资料提交成功，请耐心等待平台审核";

                    }else {
                        document.getElementById("tipShow").innerHTML="资料提交失败，请重试...";
                    }
                },
                complete:function (res){
                    console.log('请求完成',res)
                }
            })
        }
        }
    </script>
</head>
<body>

<div style="height:20px;">
    <span id="tipShow" style="color: red"></span>
</div>


<form class="form-horizontal">
    <div class="form-group">
        <label for="inputmcontact" class="col-sm-2 control-label">商家联系人</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmcontact" placeholder="请输入商家联系人">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmphone" class="col-sm-2 control-label">联系方法</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmphone" placeholder="请输入商家联系方式">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmeail" class="col-sm-2 control-label">联系邮箱</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmeail" placeholder="请输入商家邮箱">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmaddress" class="col-sm-2 control-label">联系地址</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmaddress" placeholder="请输入商家地址">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmerchantType" class="col-sm-2 control-label">商家类型</label>
        <div class="col-sm-8">
            <select class="form-control" id="inputmerchantType">
                <option value="0">个人</option>
                <option value="1">企业</option>

            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="inputmrealName" class="col-sm-2 control-label">商家真实名称</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmrealName" placeholder="请输入商家真实名称">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmidCard" class="col-sm-2 control-label">商家证件号</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmidCard" placeholder="请输入商家证件号">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmidCardImg" class="col-sm-2 control-label">商家证件图</label>
        <div class="col-sm-8">
            <input type="file"  id="inputmidCardImg">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <div class="checkbox">
                <label>
                    <input type="checkbox"> Remember me
                </label>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="button" class="btn btn-default">Sign in</button>
        </div>
    </div>
</form>
<button type="button" class="btn btn-success" onclick="subInfo()">提交</button>
</body>
</html>